home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
.net (French) 1996 November
/
.net Magazine (FR) - Issue 01 - Nov 1996.iso
/
mac
/
Outils
/
Graphique⁄images
/
GraphicConverter 2.2.2
/
Plug-ins Dev.-Kit
/
SampleImport.p
< prev
Wrap
Text File
|
1994-12-12
|
2KB
|
67 lines
unit SampleImport;
interface
uses
Header;
procedure Main (ImportPtr: T_ImportPtr);
implementation
const
C_Type = 'SamI';
C_ID = $98765432;
type
T_LongArr = array[0..10000] of Longint;
T_LongPtr = ^T_LongArr;
procedure Main (ImportPtr: T_ImportPtr);
var
longPtr: T_LongPtr;
ok: Boolean;
begin
ok := False;
{ Analyze the Data in ImportPtr^.dataHdl, the handle is locked !!! }
longPtr := T_LongPtr(ImportPtr^.srcDataHdl^);
if (longPtr^[0] = C_ID) then
begin
{ Set all dest values if this function can import the data. }
ImportPtr^.destBitsPerPixel := longPtr^[1];
ImportPtr^.destBytesPerLine := longPtr^[2];
ImportPtr^.destWidth := longPtr^[3];
ImportPtr^.destHeight := longPtr^[4];
ImportPtr^.destDataSize := longPtr^[5];
ImportPtr^.destKindStr := 'Sample File Format';
ImportPtr^.destFileType := C_Type;
BlockMove(ptr(ord4(longPtr) + 6 * 4), ptr(ImportPtr^.destColorTablePtr), 256 * 3 * 2);
{ Allocate the destDataHdl }
ImportPtr^.destDataHdl := NewHandle(ImportPtr^.destDataSize);
if MemError = noErr then
begin
HLock(ImportPtr^.destDataHdl);
BlockMove(ptr(ord4(longPtr) + 6 * 4 + 256 * 3 * 2), ImportPtr^.destDataHdl^, ImportPtr^.destDataSize);
HUnlock(ImportPtr^.destDataHdl);
ok := True;
end;
end;
{ Additional: }
{ Generate a PICT if the createVectorPict field is true and your function imports }
{ vector data (you have to allocate the vectorPictHdl with OpenPicture in this case). }
{ Set the success value to 1 if everything was ok }
if ok then
ImportPtr^.success := 1;
end;
end.